%token Name ("name") : Name
%token QuoteLiteral ("quote literal") : Constant

%xstart SQSTRING

%%

lower  = ['a'-'z']
upper  = ['A'-'Z']
digit  = ['0'-'9']
letter = lower | upper | '_'
name   = letter (letter | digit)*

non_line_terminator = [^ '\n' '\v' '\f' '\r' '\x85' '\u2028' '\u2029']

name                =>: ScanNameValue();      yield Name

"\'"     =>: BeginString(SQSTRING, True)

<SQSTRING>:
    "\'" =>: EndString(); yield QuoteLiteral
<SQSTRING>:
    non_line_terminator =>: AppendTokenString()

<SQSTRING>:
    default =>: raise UnterminatedString()
